package com.ssl.spring.security.auth.fileter;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 描述：jwt token 登录认证过滤器，认证成功，则将token写入response的header中
 * TODO 如果没有该方法，也可以手写 LoginController，来处理登录逻辑
 *
 * @author shi_senlin
 * @create 2021/05/29 10:09
 */
public class JwtAuthenticationTokenLoginFilter extends UsernamePasswordAuthenticationFilter {

    @Override
    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
        // 获取提交的帐号密码，组装成 UsernamePasswordAuthenticationToken，
     //   getAuthenticationManager().authenticate(UsernamePasswordAuthenticationToken);
        return super.attemptAuthentication(request, response);
    }
}
